<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app';
	import {
		ref
	} from 'vue';
	// import {
	// 	useVideoStore
	// } from '@/stores/modules/video'
	// import {
	// 	useUserStore
	// } from '@/stores'
	// import {
	// 	getVideoList
	// } from '@/api/control'

	const webviewSrc = ref('')
	// const videoList = ref([]);
	onLoad(option => {
		console.log('options', option)
		if (option.title) {
			uni.setNavigationBarTitle({
				title: option.title
			});
		} else {
			uni.setNavigationBarTitle({
				title: '资讯'
			});
		}

		if (option.nurl) {
			if (option.nurl !== 'null') {
				webviewSrc.value = option.nurl
			} else {
				uni.showModal({
					title: '提示',
					showCancel: false,
					content: '未配置跳转链接，无法跳转',
					success: function(res) {
						if (res.confirm) {
							uni.navigateBack()
						}
					}
				});
			}

		} else {
			uni.showModal({
				title: '提示',
				showCancel: false,
				content: '未配置跳转链接，无法跳转',
				success: function(res) {
					if (res.confirm) {
						uni.navigateBack()
					}
				}
			});
		}


	})

	// const getData = async (factoryName) => {
	// 	uni.showLoading({
	// 		title: '正在加载'
	// 	});

	// 	try {
	// 		const res = await getVideoList(factoryName);
	// 		videoList.value = res.content;
	// 		uni.hideLoading();
	// 		console.log(videoList.value)
	// 	} catch (error) {
	// 		console.log(error)
	// 		uni.hideLoading();
	// 		uni.showToast({
	// 			title: '查询监控数据失败，请稍后再试',
	// 			icon: 'error'
	// 		})

	// 	}
	// }
</script>

<template>
	<web-view :src="webviewSrc" class="webview"></web-view>
</template>



<style lang="scss">
	.webview {
		width: 100vw;
		height: 100vh;
	}
</style>